#ifndef GLPP_TEXTURE_HPP
#define GLPP_TEXTURE_HPP

#include "../PhoenixInitializer.hpp"
#include <SOIL.h>
#include <il/il.h>
#include <il/ilu.h>
#include <string>
#include <iostream>

static bool printILerror()
{
	ILenum ilError = ilGetError();
	if(ilError != IL_NO_ERROR)
	{
		std::wcerr << "ResIL Error[" << ilError << "]: "<< iluErrorString(ilError) << std::endl;
		return false;
	}
	return true;
}

namespace gl
{

class Texture
{
public:
	static gl::Texture* loadFromFile(const std::string &filepath);
	void				use();
	int					getUnit();
	static gl::Texture* getFromPath(const std::string &filepath);
	~Texture();
private:
	Texture(GLuint tex, int texUnit, int width, int height);
private:
	GLuint mTex;
	int mTexUnit;
	int mWidth, mHeight;
};

}

#endif